<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <title>Document</title>
  <style>

  </style>
</head>

<body>

</body>
<script>
  const mapData = [
    { name: '北京', value: 0 },
    { name: '河北', value: 0 },
    { name: '河南', value: 0 },
    { name: '山西', value: 0 },
    { name: '内蒙古', value: 0 },
    { name: '山东', value: 0 }
  ]

  //接口返回的数据

  const data = [
    { name: '北京', value: 10 },
    { name: '河北省', value: 8 },
    { name: '山西省', value: 5 },
    { name: '内蒙古自治区', value: 7 }
  ]


  mapData.forEach(item => {
    //判断data中是否包括当前这个省  包含的话就更换value值
    let res = data.find(a => a.name.includes(item.name))
    // console.log(res);
    if (res) {
      item.value = res.value
    }
  })
  console.log(mapData);
</script>

</html>